
# linear_search
def linear_search(arr: list, value: int):
    for i in range(len(arr)):
        if value == arr[i]:
            return i
        else:
            continue
        return -1

l = [1,4,16,8,8,10]
k = 8
print(linear_search(l,k))


# bin_search
def bin_search(arr: list, value: int):
    low = 0
    high = len(arr)-1
    while low <= high and value != -1:
        mid = (low + high) // 2
        if value < arr[mid]:
            high = mid - 1
        elif value > arr[mid]:
            low = mid +1
        else:
            return mid
